package rdd.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

import java.text.SimpleDateFormat
import java.util.Date

object Spark01_RDD_Filter {
  def main(args: Array[String]): Unit = {
    val sparkConf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("RDD")
    val sc = new SparkContext(sparkConf)
    //求相同时间段内的点击数量
    val rdd: RDD[Int] = sc.makeRDD(List(1, 2, 3, 4, 5))
    val filterRDD: RDD[Int] = rdd.filter(
      num => {
        num % 2 != 0
      }
    )
    filterRDD.collect().foreach(println)
    sc.stop()
  }

}
